home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 34.zip / BS1 part 34 / FredFish PD 319.adf / CNewsSrc / cnews.src.lzh / libcnews / str3save.c < prev    next >
C/C++ Source or Header  |  1989-07-03  |  587b  |  32 lines

  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include "libc.h"
  4. #include "news.h"
  5.  
  6. /*
  7.  - str3save - malloc space for 3 strings, concatenated, and concatenate them
  8.  * This may seem kind of ad-hoc, but it's just right for filename work.
  9.  */
  10. char *
  11. str3save(s1, s2, s3)
  12. char *s1;
  13. char *s2;
  14. char *s3;
  15. {
  16.     register char *p;
  17.     static char *empty = "";
  18.  
  19.     if (s1 == NULL)
  20.         s1 = empty;
  21.     if (s2 == NULL)
  22.         s2 = empty;
  23.     if (s3 == NULL)
  24.         s3 = empty;
  25.  
  26.     p = nemalloc((unsigned)(strlen(s1) + strlen(s2) + strlen(s3) + 1));
  27.     (void) strcpy(p, s1);
  28.     (void) strcat(p, s2);
  29.     (void) strcat(p, s3);
  30.     return(p);
  31. }
  32.